#! /bin/sh
#### Run GBmod with Xwindow Graphics

# model
model=3

# data directory
datadir=../datadir/

####  aux files
modelfile=${datadir}model${model}.data
rayendsfile=${datadir}rayend.data
rayfile=${datadir}ray.data
wavefile=${datadir}wave.data
wavefilet=${datadir}wavet.data

nangle=150 nxz=201 fangle=-45 langle=45 nt=20

####   create modelfile
# ../Models/Xmodel0{model}

####   shoot the rays 
triray <$modelfile >$rayendsfile \
        rayfile=$rayfile wavefile=$wavefile \
        nangle=$nangle fangle=$fangle langle=$langle \
        nxz=$nxz nt=$nt xs=1 zs=0.1 refseq=4,1 krecord=1 \
	refseq=1,-1

####    transpose the wavefile
transp <$wavefile >$wavefilet n1=$nt n2=$nangle nbpe=8

#### Create X-Windows display of model
sxplot <$modelfile -geom 600x450+0+0 tricolor=none \
        label1="Depth (km)" label2="Distance (km)" &

xgraph linecolor=3 <$rayfile -geom 600x450+640+520 nplot=`cat outpar` n=$nxz \
        x1beg=0 x1end=1 x2beg=0 x2end=2 \
        label1="Depth (km)" label2="Distance (km)" title="Raypaths" \
        style=seismic linecolor=3 &

xgraph linecolor=3 <$wavefilet -geom 600x450+640+0 nplot=$nt n=$nangle \
        x1beg=0 x1end=1.0 x2beg=0 x2end=2.0 \
        label1="Depth (km)" label2="Distance (km)" title="Wavefronts" \
        style=seismic linewidth=0 mark=8 marksize=4 &

exit 0
